@extends('layouts.application')
@section('css')
    <link rel="stylesheet" href="/vendor/markdown/css/editormd.min.css">
    <link rel="stylesheet" href="/vendor/webupload/dist/webuploader.css"/>
    <link rel="stylesheet" type="text/css" href="/vendor/webupload/style.css"/>
@endsection

@section('content')
    <div class="admin-content">
        @include('admin.crm.article._base')
        {!! Form::open(array('route'=>'crm.article.store','method'=>'post','class'=>'am-form')) !!}
        {{--{!! Form::token() !!}--}}
        @include('admin.crm.article._form',['legend'=>'新增文章'])
        {!! Form::close() !!}
    </div>

    <div class="admin-content">

        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">新增文章</strong> /
                    <small>Create Article</small>
                </div>
            </div>


            <hr>

            <div class="am-tabs am-margin">
                @include('layouts.shared._flash')


                {!! Form::open(array('route' => 'crm.article.store', 'method' => 'post','class'=>'am-form')) !!}
                {!! Form::token() !!}

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        {!! Form::label('category_id','所属栏目') !!}
                    </div>
                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                        {!! Form !!}
                        {{--<select multiple data-am-selected="{btnWidth: '100%',  btnStyle: 'secondary',--}}
                                    {{--btnSize: 'sm', maxHeight: 360, searchBox: 1}" name="category_id">--}}
                            {{--@foreach($categories as $category)--}}
                            {{--<option value="1">11</option>--}}
                            {{--@endforeach--}}
                        {{--</select>--}}
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        {!! Form::label('title','文章标题') !!}
                    </div>
                    <div class="am-u-sm-8 am-u-md-4">
                        {!! Form::text('title',null,array('class'=>'am-input-sm','placeholder'=>"请输入标题")) !!}
                    </div>
                    <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        {!! Form::label('author','作者') !!}
                    </div>
                    <div class="am-u-sm-8 am-u-md-4">
                        {!! Form::text('author',null,array('class'=>'am-input-sm','placeholder'=>"请输入作者")) !!}

                    </div>
                    <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        {!! Form::label('url','网址') !!}
                    </div>
                    <div class="am-u-sm-8 am-u-md-4">
                        {!! Form::text('url',null,array('class'=>'am-input-sm','placeholder'=>"请输入网址")) !!}

                    </div>
                    <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
                </div>


                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        {!! Form::label('thumb','缩略图') !!}
                    </div>

                    <div class="am-u-sm-8 am-u-md-8 am-u-end col-end">
                        <div class="am-form-group am-form-file new_thumb">
                            <button type="button" class="am-btn am-btn-success am-btn-sm">
                                <i class="am-icon-cloud-upload" id="loading"></i> 上传缩略图
                            </button>
                            {!! Form::file('image_upload',['id'=>'image_upload']) !!}
                            {!! Form::hidden('thumb') !!}
                            {{--<input type="file" id="image_upload">--}}
                            {{--<input type="hidden" name="thumb">--}}
                        </div>

                        <hr data-am-widget="divider" style="" class="am-divider am-divider-dashed"/>

                        <div>
                            <img src="" id="img_show" style="max-height: 200px;">
                        </div>
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        {!! Form::label('description','文章描述') !!}

                    </div>
                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                        {!! Form::textarea('description',null,array('class'=>'am-input-sm','placeholder'=>"请输入描述信息")) !!}

                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        {!! Form::label('is_top','是否置顶') !!}
                    </div>

                    <div class="am-u-sm-8 am-u-md-4 am-u-end col-end">
                        <label class="am-radio-inline">
                            {!! Form::radio('is_top',1,true) !!}是
                        </label>
                        <label class="am-radio-inline">
                            {!! Form::radio('is_top',0) !!}否
                        </label>
                    </div>
                </div>

                <div class="am-g am-margin-top">
                    <div class="am-u-sm-4 am-u-md-2 am-text-right">
                        {!! Form::label('content','文章内容') !!}
                    </div>
                    <div class="am-u-sm-12 am-u-md-12">
                        <div id="markdown">
                            {!! Form::textarea('content',null,['style'=>'display:none']) !!}

                        </div>
                    </div>
                </div>

                <div class="am-margin">
                    {!! Form::submit('提交保存',['class'=>'am-btn am-btn-primary am-btn-xs']) !!}
                    {!! link_to_asset('/admin/crm/article','放弃保存',['class'=>'am-btn am-btn-primary am-btn-xs']) !!}


                    {{--<a href="{{route('ad.advert.index')}}" class="am-btn am-btn-primary am-btn-xs">返回</a>--}}
                </div>
                {!! Form::close() !!}
            </div>
        </div>

        <footer class="admin-content-footer">
            <hr>
            <p class="am-padding-left">© 2017-06.</p>
        </footer>
    </div>

@endsection

@section('js')
    <script src="/vendor/html5-fileupload/jquery.html5-fileupload.js"></script>
    <script src="/js/upload.js"></script>

    <script src="/vendor/markdown/editormd.min.js"></script>
    <script src="/js/editormd_config.js"></script>

    <script type="text/javascript" src="/vendor/webupload/dist/webuploader.js"></script>
    <script type="text/javascript" src="/vendor/webupload/upload.js"></script>

@endsection
